package org.testis.testdriver.translation;

import java.util.HashMap;



/**
 *
 * @author barisergun
 */
public abstract class AtofValueTranslateAction
{

    protected AtofValueTranslateAction m_successor;
    protected  HashMap<String,String> m_exceptions;
    
    public AtofValueTranslateAction()
    {
        if(m_exceptions == null)
        {
            m_exceptions = new HashMap<String,String>();
        
        }
    }

    public void setSuccessor(AtofValueTranslateAction successor)
    {
        this.m_successor = successor;
    }


    /**
     * Execute action and operate next step with m_successor if any
     * @param request
     * @return
     */
    public String processTranslation(String value)
    {
        String resultingValue = operateRequest(value);
        if (m_successor != null) {
            resultingValue = m_successor.processTranslation(
                resultingValue);
        }
        return resultingValue;
    }


    /**
     * Action is executed over this function
     * @param value String input for comparision
     * @return String
     */
    abstract public String operateRequest(String value);
    
    
    public HashMap<String,String> getExceptions()
    {
        return m_exceptions;
    }        
    
    public void resetExceptions()
    {
        m_exceptions.clear();
    }
}
